﻿<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>CSS3鼠标悬停文字线条边框特效 - 站长素材</title>

<style>
html, body {
  color: white;
  background: #323232;
  font-weight: lighter;
}

h1, h2, h3, h4 {
  font-family: "Oswald";
}

.wrapper {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
      -ms-flex-direction: column;
          flex-direction: column;
  -ms-flex-wrap: wrap;
      flex-wrap: wrap;
  -webkit-box-align: center;
      -ms-flex-align: center;
          align-items: center;
  -webkit-box-pack: center;
      -ms-flex-pack: center;
          justify-content: center;
}
.wrapper .row {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  margin: 10px 0;
}
.wrapper h2 {
  font-size: 1.8em;
}

.text-button {
  position: relative;
  cursor: pointer;
  color: white;
  font-family: "Lato";
  font-size: 1.5em;
  padding: 0.5em 1em 0.65em;
  margin: 0 10px;
}
.text-button .text-inner {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}
.text-button:nth-of-type(1):before, .text-button:nth-of-type(1):after, .text-button:nth-of-type(1) .text-inner:before, .text-button:nth-of-type(1) .text-inner:after {
  background-color: #ffa726;
}
.text-button:nth-of-type(2):before, .text-button:nth-of-type(2):after, .text-button:nth-of-type(2) .text-inner:before, .text-button:nth-of-type(2) .text-inner:after {
  background-color: #26a69a;
}
.text-button:nth-of-type(3):before, .text-button:nth-of-type(3):after, .text-button:nth-of-type(3) .text-inner:before, .text-button:nth-of-type(3) .text-inner:after {
  background-color: #7e57c2;
}
.text-button:before, .text-button:after, .text-button .text-inner:before, .text-button .text-inner:after {
  position: absolute;
  content: "";
  display: block;
  -webkit-transition: -webkit-transform 0.3s;
  transition: -webkit-transform 0.3s;
  transition: transform 0.3s;
  transition: transform 0.3s, -webkit-transform 0.3s;
}
.text-button.horizontal:before, .text-button.horizontal:after, .text-button.both:before, .text-button.both:after {
  left: 0;
  width: 100%;
  height: 2px;
  -webkit-transform: scaleX(0);
          transform: scaleX(0);
}
.text-button.horizontal .text-inner:before, .text-button.horizontal .text-inner:after, .text-button.both .text-inner:before, .text-button.both .text-inner:after {
  top: 0;
  width: 2px;
  height: 100%;
  -webkit-transform: scaleY(0);
          transform: scaleY(0);
}
.text-button.horizontal .text-inner:before, .text-button.both .text-inner:before {
  left: 0;
}
.text-button.horizontal .text-inner:after, .text-button.both .text-inner:after {
  right: 0;
}
.text-button.horizontal .text-inner:hover:before, .text-button.horizontal .text-inner:hover:after, .text-button.both .text-inner:hover:before, .text-button.both .text-inner:hover:after {
  -webkit-transform: scaleY(1);
          transform: scaleY(1);
}
.text-button.horizontal:before, .text-button.both:before {
  top: 0;
}
.text-button.horizontal:after, .text-button.both:after {
  bottom: 0;
}
.text-button.horizontal:hover:before, .text-button.horizontal:hover:after, .text-button.both:hover:before, .text-button.both:hover:after {
  -webkit-transform: scaleX(1);
          transform: scaleX(1);
}
.text-button.horizontal:hover .text-inner:before, .text-button.horizontal:hover .text-inner:after, .text-button.both:hover .text-inner:before, .text-button.both:hover .text-inner:after {
  -webkit-transform: scaleY(1);
          transform: scaleY(1);
}
.text-button.horizontal.clockwise .text-inner:before, .text-button.both.clockwise .text-inner:before {
  -webkit-transform-origin: top center;
          transform-origin: top center;
}
.text-button.horizontal.clockwise .text-inner:after, .text-button.both.clockwise .text-inner:after {
  -webkit-transform-origin: bottom center;
          transform-origin: bottom center;
}
.text-button.horizontal.clockwise:before, .text-button.both.clockwise:before {
  -webkit-transform-origin: right center;
          transform-origin: right center;
}
.text-button.horizontal.clockwise:after, .text-button.both.clockwise:after {
  -webkit-transform-origin: left center;
          transform-origin: left center;
}
.text-button.horizontal.clockwise:hover .text-inner:before, .text-button.both.clockwise:hover .text-inner:before {
  -webkit-transform-origin: bottom center;
          transform-origin: bottom center;
}
.text-button.horizontal.clockwise:hover .text-inner:after, .text-button.both.clockwise:hover .text-inner:after {
  -webkit-transform-origin: top center;
          transform-origin: top center;
}
.text-button.horizontal.clockwise:hover:before, .text-button.both.clockwise:hover:before {
  -webkit-transform-origin: left center;
          transform-origin: left center;
}
.text-button.horizontal.clockwise:hover:after, .text-button.both.clockwise:hover:after {
  -webkit-transform-origin: right center;
          transform-origin: right center;
}
.text-button.horizontal.counterclockwise .text-inner:before, .text-button.both.counterclockwise .text-inner:before {
  -webkit-transform-origin: bottom center;
          transform-origin: bottom center;
}
.text-button.horizontal.counterclockwise .text-inner:after, .text-button.both.counterclockwise .text-inner:after {
  -webkit-transform-origin: top center;
          transform-origin: top center;
}
.text-button.horizontal.counterclockwise:before, .text-button.both.counterclockwise:before {
  -webkit-transform-origin: left center;
          transform-origin: left center;
}
.text-button.horizontal.counterclockwise:after, .text-button.both.counterclockwise:after {
  -webkit-transform-origin: right center;
          transform-origin: right center;
}
.text-button.horizontal.counterclockwise:hover .text-inner:before, .text-button.both.counterclockwise:hover .text-inner:before {
  -webkit-transform-origin: top center;
          transform-origin: top center;
}
.text-button.horizontal.counterclockwise:hover .text-inner:after, .text-button.both.counterclockwise:hover .text-inner:after {
  -webkit-transform-origin: bottom center;
          transform-origin: bottom center;
}
.text-button.horizontal.counterclockwise:hover:before, .text-button.both.counterclockwise:hover:before {
  -webkit-transform-origin: right center;
          transform-origin: right center;
}
.text-button.horizontal.counterclockwise:hover:after, .text-button.both.counterclockwise:hover:after {
  -webkit-transform-origin: left center;
          transform-origin: left center;
}
.text-button.vertical:before, .text-button.vertical:after {
  top: 0;
  width: 2px;
  height: 100%;
  -webkit-transform: scaleY(0);
          transform: scaleY(0);
}
.text-button.vertical:before {
  left: 0;
}
.text-button.vertical:after {
  right: 0;
}
.text-button.vertical:hover:before, .text-button.vertical:hover:after {
  -webkit-transform: scaleY(1);
          transform: scaleY(1);
}
.text-button.vertical.clockwise:before {
  -webkit-transform-origin: top center;
          transform-origin: top center;
}
.text-button.vertical.clockwise:after {
  -webkit-transform-origin: bottom center;
          transform-origin: bottom center;
}
.text-button.vertical.clockwise:hover:before {
  -webkit-transform-origin: bottom center;
          transform-origin: bottom center;
}
.text-button.vertical.clockwise:hover:after {
  -webkit-transform-origin: top center;
          transform-origin: top center;
}
.text-button.vertical.counterclockwise:before {
  -webkit-transform-origin: bottom center;
          transform-origin: bottom center;
}
.text-button.vertical.counterclockwise:after {
  -webkit-transform-origin: top center;
          transform-origin: top center;
}
.text-button.vertical.counterclockwise:hover:before {
  -webkit-transform-origin: top center;
          transform-origin: top center;
}
.text-button.vertical.counterclockwise:hover:after {
  -webkit-transform-origin: bottom center;
          transform-origin: bottom center;
}

.codepen-link {
  position: absolute;
  bottom: 30px;
  right: 30px;
  height: 40px;
  width: 40px;
  z-index: 10;
  border-radius: 50%;
  box-sizing: border-box;
  background-image: url("");
  background-position: center center;
  background-size: cover;
  opacity: 0.5;
  -webkit-transition: all 0.25s;
  transition: all 0.25s;
}
.codepen-link:hover {
  opacity: 0.8;
  box-shadow: 0 0 6px #efefef;
}
</style>
</head>
<body>

<div class="wrapper">
  <h2>Clockwise</h2>
  <div class="row">
    <div class="text-button clockwise horizontal">Horizontal</div>
    <div class="text-button clockwise vertical">Vertical</div>
    <div class="text-button clockwise both">Both
      <div class="text-inner"></div>
    </div>
  </div>
  <h2>Counter-clockwise</h2>
  <div class="row">
    <div class="text-button counterclockwise horizontal">Horizontal</div>
    <div class="text-button counterclockwise vertical">Vertical</div>
    <div class="text-button counterclockwise both">Both
      <div class="text-inner"></div>
    </div>
  </div>
</div>

<div style="text-align:center;margin:50px 0; font:normal 14px/24px 'MicroSoft YaHei';">
<p>适用浏览器：360、FireFox、Chrome、Opera、傲游、搜狗、世界之窗. 不支持Safari、IE8及以下浏览器。</p>
<p>来源：<a href="http://sc.chinaz.com/" target="_blank">站长素材</a></p>
</div>
</body>
</html>